package com.swx.service;

import com.mg.swagger.framework.configuration.EnableSwaggerMgUi;
import com.mg.swagger.framework.service.MgStorageService;
import com.swx.repostory.MyDataRepostory;
import jdk.nashorn.internal.runtime.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @author lxh
 * @create 2019-04-10 11:42
 * @desc MgStorageService接口用于保存模拟数据
 **/
@Service
@EnableSwaggerMgUi
@Logger
public class MyService implements MgStorageService {

    Map<String, String> map = new HashMap<>();


    @Autowired
    MyDataRepostory repostory;

    @Override
    public String get(String s) {
        return map.get(s);
//        return JSON.toJSONString(repostory.findById(s).get());
//        return null;
    }

    @Override
    public void put(String s, String s1) {
        map.put(s, s1);

//        MyData myData = new MyData();
//        myData.setName(s);
//        myData.setData(s1);
//        log.info(JSON.toJSONString(myData));
//        repostory.save(myData);
    }
}
